import request from '@/utils/request'

// 请求所有店铺列表的详情
export const getAllStore = () => {
  return request({
    url: `storesLists`
  })
}

// 请求所有店铺列表的详情
export const getAllStoreList = (page, limit) => {
  return request({
    url: `storesLists?_page=${page}&_limit=${limit}`
  })
}

// 根据店铺名称或者行业来 请求对应的所有店铺列表的详情
export const getAllStoreListbyTag = params => {
  return request({
    url: 'storesLists',
    params
  })
}

// 根据id删除店铺
export const delStoreById = id => {
  return request({
    url: `storesLists/${id}`,
    method: 'DELETE'
  })
}

// 根据id 开启 店铺
export const openStoreById = data => {
  return request({
    url: `storesLists/${data.id}`,
    method: 'PUT',
    data
  })
}

// 根据店铺ID 获取店铺信息
export const getStoreById = id => {
  return request({
    url: `storesLists?storeNum=${id}`
  })
}

// 根据店铺ID 获取店铺x详细信息信息
export const getStoreDetailsById = id => {
  return request({
    url: `storeDetails?storeNum=${id}`
  })
}

// 根据数据的ID 保存店铺信息
export const updateStoreBaseInfo = data => {
  return request({
    url: `storesLists/${data.id}`,
    method: 'PUT',
    data
  })
}

// 根据数据的ID 保存店铺信息详细信息
export const updateStoreDetails = data => {
  return request({
    url: `storeDetails/${data.id}`,
    method: 'PUT',
    data
  })
}

// 获取店铺行业
export const getIndustry = () => {
  return request({
    url: `storeIndustryErins`
  })
}

// 根据店铺ID 获取店铺配送信息
export const getStoreDeliveryById = id => {
  return request({
    url: `storesAudits?storeNum=${id}`
  })
}

// 店铺审核通过
export const approveStore = data => {
  return request({
    url: `storesLists/${data.id}`,
    method: 'PUT',
    data
  })
}

